using System.ComponentModel.DataAnnotations;
using Trust.Casas.Model.Entities;
using Se.Framework.Web.Mvc.GenericCrud;
using Se.Framework.Web.Mvc.GenericCrud.Attributes;

namespace Trust.Casas.Web.Areas.Admin.Models
{
    [GenericCrudTableData("Detalles de usuarios", typeof(UserDetail), "Id", MetadataType = typeof(UserDetailMetadata))]
    public class UserDetailMetadata
    {
        [GenericCrudColumn(RenderMode = GenericCrudRenderMode.None)]
        public int Id { get; set; }

        [Required]
        [Display(Name = "Nombre")]
        public string FirstName { get; set; }

        [Required]
        [Display(Name = "Apellido")]
        public string LastName { get; set; }
        
        [Display(Name = "Usuario", GroupName = "UserId")]
        [GenericCrudColumn(RenderMode = GenericCrudRenderMode.DisplayModeOnly, SearchType = typeof(User), SearchKey = "UserId", Sortable = true)]
        public User User { get; set; }

        [Display(Name = "Usuario")]
        [GenericCrudColumn(RenderMode = GenericCrudRenderMode.EditModeOnly, SearchType = typeof(User))]
        public int UserId { get; set; }
    }
}